package com.itheima.mapper;

import com.itheima.domain.pojo.Clazz;
import com.itheima.domain.pojo.ClazzQueruparam;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ClazzMapper {



    @Insert("insert into clazz(name,room,begin_date,end_date,master_id,subject,create_time,update_time) value(#{name},#{room},#{beginDate},#{endDate},#{masterId},#{subject},#{createTime},#{updateTime}) ")
    void save(Clazz clazz);

    @Select("select id,name,room,begin_date beginDate ,end_date endDate,master_id masterId,subject,create_time createTime,update_time updateTime from clazz")
    List<Clazz> saveList();


    List<Clazz> list(ClazzQueruparam clazzQueruparam);

    @Delete("delete from clazz where id=#{id}")
    void deleteById(Integer id);

    @Select("select id,name,room,begin_date beginDate ,end_date endDate,master_id masterId,subject,create_time createTime,update_time updateTime from clazz where id=#{id}")
    Clazz getById(Integer id);

    //修改班级信息
    @Update("update clazz set name=#{name},room=#{room},begin_date=#{beginDate},end_date=#{endDate},master_id=#{masterId},subject=#{subject},update_time=#{updateTime} where id=#{id}")
    void update(Clazz clazz);
}
